{extend name='admin@public/content'}

{block name="button"}
<!--{if auth("$classuri/add")}-->
<button data-open='{:url("$classuri/add")}' data-title="添加文章" class='layui-btn layui-btn-sm layui-btn-primary'>添加文章</button>
<!--{/if}-->

<!--{if auth("$classuri/del")}-->
<button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-sm layui-btn-primary'>删除文章</button>
<!--{/if}-->
{/block}

{block name="content"}
<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">文章标题</label>
        <div class="layui-input-inline">
            <input name="title" value="{$Think.get.title}" placeholder="输入文章标题" class="layui-input w200">
        </div>
    </div>

    <!--{if !empty($category_list)}-->
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">文章类型</label>
        <div class="layui-input-inline">
            <select name="cate_id" lay-search>
                <option value="">所有</option>
                {foreach $category_list as $key=>$type}
                <!--{if $Think.get.cate_id eq $key}-->
                <option selected="selected" value="{$key}">{$type}</option>
                <!--{else}-->
                <option value="{$key}">{$type}</option>
                <!--{/if}-->
                {/foreach}
            </select>
        </div>
    </div>
    <!--{/if}-->

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    <!--{if empty($data_list)}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action"/>
    <table class="layui-table notevent" lay-skin="line">
        <thead>
        <tr>
            <th class='list-table-check-td'>
                <input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
            </th>
            <th class='list-table-sort-td'>ID</th>
            <th class="w150">文章分类</th>
            <th class="w150">标题</th>
            <th class="w150">开课时间</th>
            <th class="w150">课时</th>
            <th class="w150">发布时间</th>
            <th class="w72">状态</th>
            <th class='text-center w120'>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $data_list as $key=>$vo}
        <tr>
            <td class='list-table-check-td'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'/>
            </td>
            <td class='list-table-sort-td'>{$vo.id}</td>
            <td>{$vo.category_txt}</td>
            <td>{if $vo['recommend'] == 1}<span style="color:red;padding-right:10px;display:inline-block;">[推荐]</span>{/if}{$vo.title}</td>
            <td>{$vo.teach_time}</td>
            <td>{$vo.timer}</td>

            <td>{$vo.create_time||date="Y-m-d H:i"}</td>
            <td>{$vo.status_txt}</td>
            <td class='text-center nowrap'>
                {if $vo['status'] == 2}
                <a data-update="{$vo.id}" data-field="status" data-value='1' data-action='{:url("$classuri/changeTabelVal")}?id={$vo.id}' class="changeTabelVal" href="javascript:void(0)">取消发布</a>
                {else/}
                <a data-update="{$vo.id}" data-field="status" data-value='2' data-action='{:url("$classuri/changeTabelVal")}?id={$vo.id}' class="changeTabelVal" href="javascript:void(0)">发布</a>

                {/if}
                {if $vo['recommend'] == 1}
                <a data-update="{$vo.id}" data-field="recommend" data-value='2' data-action='{:url("$classuri/changeTabelVal")}?id={$vo.id}' class="changeTabelVal" href="javascript:void(0)">取消推荐</a>

                {else/}
                <a data-update="{$vo.id}" data-field="recommend" data-value='1' data-action='{:url("$classuri/changeTabelVal")}?id={$vo.id}' class="changeTabelVal" href="javascript:void(0)">推荐</a>

                {/if}

                {if auth("$classuri/edit")}
                <span class="text-explode">|</span>
                <a data-open='{:url("$classuri/edit")}?id={$vo.id}' href="javascript:void(0)">编辑</a>
                {/if}
                {if auth("$classuri/del")}
                <span class="text-explode">|</span>
                <a data-update="{$vo.id}" data-field='delete' data-action='{:url("$classuri/del")}' href="javascript:void(0)">删除</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        {/if}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/if}-->
</form>
<script>
    (function () {
        window.form.render();
    })();
</script>
{/block}